:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.5;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* 色彩系统 - 6级色彩层次（WCAG优化版） */
  --color-light: rgba(255, 255, 255, 0.96);
  --color-mid: rgba(226, 232, 240, 0.94);
  --color-dark: rgba(51, 65, 85, 0.92);
  --color-hover: rgba(59, 130, 246, 0.15);
  --color-border: rgba(203, 213, 225, 0.8); /* 优化对比度 */
  --color-bg: rgba(248, 250, 252, 0.96);
  --color-main: rgba(255, 255, 255, 0.95); /* 提高不透明度增强对比度 */
  --color-accent: rgba(37, 99, 235, 1); /* 更深的蓝色，WCAG合规 */
  
  /* 文本颜色（WCAG优化版） */
  --text-primary: #1e293b; /* 深灰色，对比度 > 7:1 */
  --text-secondary: #475569; /* 中灰色，对比度 > 4.5:1 */
  --text-accent: var(--color-accent);
  
  /* 阴影系统 */
  --shadow-default: 0 4px 12px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.04);
  --shadow-card: var(--shadow-default);
  --shadow-card-hover: var(--shadow-hover);
  
  /* 圆角系统 */
  --radius-small: 5px;
  --radius-medium: 8px;
  --radius-large: 12px;
  --radius-full: 50%;
}

/* 重置样式 */
body {
  margin: 0;
  padding: 0;
  min-width: 320px;
  color: var(--text-primary);
  background-color: var(--color-bg);
}

  /* 整个滚动条 */
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  /* 滚动条上的滚动滑块 */
  ::-webkit-scrollbar-thumb {
    background-color: #49b1f5;
    /* 关键代码 */
    background-image: -webkit-linear-gradient(45deg,
    rgba(255, 255, 255, 0.4) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0.4) 75%,
    transparent 75%,
    transparent);
    border-radius: 32px;
  }

  /* 滚动条轨道 */
  ::-webkit-scrollbar-track {
    background-color: #dbeffd;
    border-radius: 32px;
  }


/* 布局样式 */
.flex {
  display: flex;
}

.flex-1 {
  flex: 1 1 0%;
}

.w-full {
  width: 100%;
}

.h-screen {
  height: 100vh;
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-y-auto {
  overflow-y: auto;
}

.flex-col {
  flex-direction: column;
}

/* 排版规范 */
h1, .text-h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: bold;
  color: var(--text-primary);
}

h2, .text-h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

h3, .text-h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

p, .text-body {
  font-size: 1rem;
  color: var(--text-primary);
  text-wrap: balance;
}

.text-xs {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* 自定义工具类 */
/* 文本平衡 */
.text-balance {
  text-wrap: balance;
}

/* 背景网格图案 */
.grid-pattern {
  background-image: radial-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* 卡片样式 */
.card {
  background-color: var(--color-main);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

/* 情感化卡片样式 */
.card-emotional {
  composes: card;
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,250,252,0.98) 100%);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-emotional:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 
    0 12px 28px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(59, 130, 246, 0.12);
}

/* 玻璃态效果 */
.glass {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* 激活状态 */
.active {
  position: relative;
}

.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: var(--color-accent);
}

/* 微妙动画 */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.float {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* 暗色主题样式（WCAG优化版） */
.dark {
  /* 色彩系统 - 暗色主题 */
  --color-light: rgba(30, 41, 59, 0.96);
  --color-mid: rgba(51, 65, 85, 0.94);
  --color-dark: rgba(15, 23, 42, 0.92);
  --color-hover: rgba(59, 130, 246, 0.25);
  --color-border: rgba(100, 116, 139, 0.6); /* 优化对比度 */
  --color-bg: rgba(15, 23, 42, 0.98);
  --color-main: rgba(30, 41, 59, 0.95); /* 提高不透明度 */
  --color-accent: rgba(96, 165, 250, 1);
  
  /* 文本颜色（WCAG优化版） */
  --text-primary: #f1f5f9; /* 更亮的文本，对比度 > 7:1 */
  --text-secondary: #cbd5e1; /* 中等亮度，对比度 > 4.5:1 */
  --text-accent: var(--color-accent);
  
  /* 阴影系统 */
  --shadow-default: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* Tab栏专业UED设计 */
#tab-bar {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.98) 0%, rgba(241, 245, 249, 0.96) 100%) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#tab-bar::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

/* Tab项基础样式 */
.tab-item {
  position: relative;
  display: flex !important;
  align-items: center !important;
  min-width: 120px !important;
  max-width: 200px !important;
  height: 36px !important;
  padding: 0 12px 0 16px !important;
  margin: 0 -1px !important; /* 负边距让Tab紧挨着 */
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(148, 163, 184, 0.15) !important;
  border-radius: 8px 8px 0 0 !important;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Tab项悬停效果 */
.tab-item:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-1px) !important;
  z-index: 5 !important; /* 悬停时提升层级 */
}

/* 激活状态的Tab项 */
.tab-item.active {
  background: rgba(255, 255, 255, 1) !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
  border-bottom-color: transparent !important;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.15) !important;
  z-index: 10 !important;
}

.tab-item.active::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa) !important;
  border-radius: 1px;
}

/* Tab名称样式 */
.tab-name {
  flex: 1 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--text-secondary) !important; /* 使用优化后的对比度颜色 */
  margin-right: 8px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  max-width: calc(100% - 28px) !important;
  min-width: 0 !important;
}

.tab-item.active .tab-name {
  color: var(--color-accent) !important; /* 使用优化后的强调色 */
  font-weight: 600 !important;
}

/* 关闭按钮样式 */
.tab-close-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 4px !important;
  color: #94a3b8 !important;
  font-size: 16px !important;
  font-weight: 300 !important;
  transition: all 0.2s ease !important;
  margin-left: auto !important;
  flex-shrink: 0 !important;
}

.tab-close-btn:hover {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #dc2626 !important;
  transform: scale(1.1) !important;
}

.tab-item.active .tab-close-btn {
  color: #64748b !important;
}

.tab-item.active .tab-close-btn:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #dc2626 !important;
}

/* Tab栏间距优化 */
#tab-bar {
  gap: 0 !important; /* 移除间距 */
  padding: 0 12px !important;
}

/* 暗色主题适配 */
.dark #tab-bar {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.96) 100%) !important;
  border-bottom-color: rgba(100, 116, 139, 0.3) !important;
}

.dark .tab-item {
  background: rgba(30, 41, 59, 0.85) !important;
  border-color: rgba(100, 116, 139, 0.2) !important;
}

.dark .tab-item:hover {
  background: rgba(30, 41, 59, 0.95) !important;
  border-color: rgba(100, 116, 139, 0.4) !important;
}

.dark .tab-item.active {
  background: rgba(30, 41, 59, 1) !important;
  border-color: rgba(96, 165, 250, 0.4) !important;
}

.dark .tab-name {
  color: #cbd5e1 !important;
}

.dark .tab-item.active .tab-name {
  color: #60a5fa !important;
}

.dark .tab-close-btn {
  color: #64748b !important;
}

.dark .tab-close-btn:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
}

/* 强制隐藏所有滚动条 */
.no-scrollbar {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

.no-scrollbar::-webkit-scrollbar {
  display: none;  /* Chrome, Safari and Opera */
}

.dark body {
  background-color: var(--color-bg);
  color: var(--text-primary);
}

.dark .card {
  background-color: var(--color-main);
  border-color: var(--color-border);
}

.dark .btn-secondary {
  background-color: #334155;
  color: #e2e8f0;
}

.dark .btn-secondary:hover {
  background-color: #475569;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .lg\:hidden {
    display: none !important;
  }
  
  .sidebar-mobile {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    height: 100% !important;
    z-index: 1000 !important;
    background-color: var(--color-main) !important;
  }
}

/* 页面加载动画 */
.page-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.page-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* 页面过渡动画 */
.page-transition {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tab切换动画 */
.tab-content {
  animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 菜单展开动画 */
.menu-expand {
  animation: expand 0.2s ease-out;
}

@keyframes expand {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 500px;
    opacity: 1;
  }
}

/* 按钮点击效果 */
.btn-click {
  animation: click 0.2s ease;
}

@keyframes click {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* 通知动画 */
.notification {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 按钮效果 */
.btn-hover {
  transition: all 0.3s ease;
}

.btn-hover:hover {
  background-color: var(--color-hover);
}

/* 自定义按钮样式 */
.btn-primary {
  background-color: #3b82f6;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: background-color 0.3s ease;
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-secondary {
  background-color: #e2e8f0;
  color: #1e293b;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: background-color 0.3s ease;
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

/* 情感化按钮样式 */
.btn-emotional {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-emotional::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
  border-radius: 50%;
}

.btn-emotional:active::before {
  width: 300px;
  height: 300px;
}

.btn-emotional:active {
  transform: scale(0.95);
}

/* 用户下拉菜单样式 */
#user-dropdown-menu {
  transition: all 0.3s ease-in-out !important;
  opacity: 0;
  transform: translateY(-10px);
}

#user-dropdown-menu:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}
